package tests;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.SystemUtils;

import ar.com.ktulu.yenc.YEncDecoder;

public class TestYenc {

    /**
     * @param args
     */
    public static void main(String[] args) {
        String inFileName = "bill.txt.ntx";
        String outFileName = "out.ntx";
        InputStream in = null;
        OutputStream out = null;
        System.out.println("User home: " + SystemUtils.USER_HOME);
        System.out.println("User Dir: " + SystemUtils.USER_DIR);
        try{
            in = new FileInputStream(inFileName);
            out = new FileOutputStream(outFileName);
            YEncDecoder yencoder = new YEncDecoder();
            yencoder.debugMessages(true);
            yencoder.setInputStream(in);
            yencoder.setOutputStream(out);
            yencoder.decode();
        }
        catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
        finally{
            IOUtils.closeQuietly(in);
            IOUtils.closeQuietly(out);
        }

    }
}
